using GameFramework;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using UnityEngine;

namespace LS.UI
{
    /// <summary>
    /// 对话框显示数据。
    /// </summary>
    public class MessageBoxParams : UIFormParams
    {
        public string Title
        {
            get;
            set;
        }

        /// <summary>
        /// 消息内容。
        /// </summary>
        public string Message
        {
            get;
            set;
        }

        /// <summary>
        /// 弹出窗口时是否暂停游戏。
        /// </summary>
        public bool PauseGame
        {
            get;
            set;
        }

        /// <summary>
        /// 按钮文案，按钮数量会依据该数组数量生成
        /// </summary>
        public string[] ButtonLabels;

        /// <summary>
        /// 按钮事件
        /// </summary>
        public GameFrameworkAction<int> ButtonClickEvent;

        public static MessageBoxParams Create(object userData, string title, string message, string[] buttonTexts, GameFrameworkAction<int> buttonEvent = null, bool pauseGame = true)
        {
            MessageBoxParams p = Create<MessageBoxParams>(userData);
            p.Title = title;
            p.Message = message;
            p.ButtonClickEvent = buttonEvent;
            p.ButtonLabels = buttonTexts;
            p.PauseGame = pauseGame;
            return p;
        }

        public override void Clear()
        {
            Title = null;
            Message = null;
            ButtonClickEvent = null;
            ButtonLabels = null;
            PauseGame = true;
            base.Clear();
        }

    }

}